package _interview75;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 151. 反转字符串中的单词
 */
public class No151 {
    public String reverseWords(String s) {
        List<String> list = Arrays.stream(s.split(" ")).filter(u -> !u.isEmpty()).collect(Collectors.toList());
        Collections.reverse(list);
        return String.join(" ", list);
    }
}
